package com.duan.laugh.tx.one.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import com.duan.laugh.common.core.exception.CheckedException;
import com.duan.laugh.tx.one.api.TestA;
import com.duan.laugh.tx.one.feign.LaughTestAService;
import com.duan.laugh.tx.one.mapper.TestAMapper;
import com.duan.laugh.tx.one.service.TestAService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author duanjw
 */
@Service
public class TestAServiceImpl extends ServiceImpl<TestAMapper, TestA> implements TestAService {
    @Autowired
    private LaughTestAService laughTestAService;

    @LcnTransaction
    @Transactional
    @Override
    public void testTx() {
        laughTestAService.testTx();
        baseMapper.insert(new TestA(1L));
        throw new CheckedException("出bug了，回滚吧");
    }
}
